home *** CD-ROM | disk | FTP | other *** search
/ Gekkan Dennou Club 145 / Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z / Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin / games / spassion / knowhow.lzh / ノウハウ / sam_sh.bas < prev    next >
BASIC Source File  |  1993-11-10  |  19KB  |  687 lines

  1. char s,n
  2. int   i,j
  3. int   x,y
  4. float fx,fy,f
  5. /*
  6. /*===============[ ジキ ]================================
  7.     int  jx,jy        /* ジキザヒョウ
  8.     int  j_sp=6        /* ジキソクド
  9. dim int  j_vx(9),j_vy(9)    /*ジキ イドウベクトル
  10. dim char tenkey(9)={0,8,9,6,3,2,1,4,7}
  11. /*
  12.     int jk        /* ジキカタムキ
  13.     int old_strig    /* マエノループノ トリガノアタイ
  14.     int jd_way = 14    /* ( ジキショットノホウコウスウ )-1
  15. /*
  16. /*===============[ ジキダン ]=============================
  17.     char jd_max=59    /* ( ガメンチュウノ サイダイスウ )-1
  18. dim int  jd_x(63) ,jd_y(63)    /* ザヒョウ
  19. dim int  jd_vx(63),jd_vy(63)    /* ベクトル
  20. dim int  jd_vx_dat(15),jd_vy_dat(15)    /* ジキノカクサンショットノ ベクトルデータ
  21. dim char jd_stock(63)    /* ガメンガイニアル ジキダンノ ナンバー
  22.     char jd_pointer    /* jd_stock ノ ポインタ
  23. /*
  24. /*===============[ ハヘン ]================================
  25.     char ha_max=63    /* ( ガメンチュウノ サイダイスウ )-1
  26. dim int  ha_x(63) ,ha_y(63)    /* ザヒョウ
  27. dim int  ha_vx(63),ha_vy(63)    /* ベクトル
  28. dim char ha_s(63)    /* ハヘンノ シュルイナンバー
  29. dim char ha_timer(63)    /* ハヘンノ ショリヨウ
  30. dim char ha_stock(63)    /* ガメンガイニアル ハヘンノ ナンバー
  31.     char ha_pointer    /* ha_stock ノ ポインタ
  32. /*
  33. /*===============[ テキ ]=================================
  34.     char tk_max=31    /* ( ガメンチュウノ サイダイスウ )-1
  35. dim int  tk_x(63) ,tk_y(63)    /* ザヒョウ
  36. dim int  tk_vx(63),tk_vy(63)    /* ベクトル
  37. dim char tk_s(63)    /* テキノ シュルイナンバー
  38. dim char tk_ang(63)    /* テキノ ホウコウナンバー
  39. dim char tk_com(63)    /* テキノ シュウゴウタイ カンリヘンスウ
  40. dim char tk_timer(63)    /* テキノ ショリヨウ
  41. dim char tk_attrib(63)    /* テキノ ショリノ ゾクセイ
  42.             /* ビット0 ーーー ジキヘノ アタリハンテイノ ウム
  43.             /* ビット1 ーーー ジキダンヘノ アタリハンテイノ ウム
  44.             /* ビット2 ーーー ガメンガイニデタカ?チェックノ ウム
  45. dim char tk_stock(63)    /* ガメンガイニ デタ テキノナンバー
  46.     char tk_pointer    /* tk_stock ノ ポインタ
  47. dim int  tk_life(63)    /* テキノ タイキュウリョク
  48. dim int  tk_life_dat(6)={0,0,0, 1,1,30,30}    /*テキノ シュルイベツ タイキュウリョクデータ
  49. /*
  50. /*=================[ カソウ VRAM ]=========================
  51.   int xxxxx1(255)        /* アンゼンバッファ
  52.   int hit_chk_x(255)        /* アタリハンテイヨウ カソウVRAM
  53.   int xxxxx2(255)        /* アンゼンバッファ
  54.   int hit_chk_y(255)        /* アタリハンテイヨウ カソウVRAM
  55.   int xxxxx3(255)        /* アンゼンバッファ
  56. /*
  57. /*=================[ ソノタ ]==============================
  58. float cir_x(255)  ,cir_y(255)
  59.   int cir_2x(255) ,cir_2y(255)
  60.   int cir_4x(255) ,cir_4y(255)
  61.   int cir_8x(255) ,cir_8y(255)
  62.   int cir_16x(255),cir_16y(255)
  63.   int cir_64x(255),cir_64y(255)
  64.   int hd16(255)            /* スプライトコード ハンテンデータ
  65.   int hd32(255)            /* スプライトコード ハンテンデータ
  66.  char qtoc(255)            /* タンイベクトルヘンカンヨウ カクドデータ
  67.  char bom_ang1,bom_ang2        /* bom ルーチンデ シヨウ
  68.  char r1,r7,r255,r1023
  69. /*============[ ショキチセッテイ & ソノタノショキカ ]===================
  70. game_init()
  71. home(0,0,0)
  72. fill(0,0,10,255,1)    /* ショリソクドメーター
  73. /*
  74. /*
  75. /*
  76. /*
  77. /*======================================================
  78. /*######################################################
  79. /*
  80. /*    MAIN
  81. /*
  82. /*######################################################
  83. /*======================================================
  84. /*
  85. /*
  86. while inkey$(0)=""
  87. vwait2(0)
  88. palet(1,65535)        /* ショリソクドメーター ON
  89. /*----------------[ カソウvramクリア ]---------------
  90.   hit_chk_x(0)=0  :hit_chk_y(0)=0
  91.   hit_chk_x(1)=0  :hit_chk_y(1)=0
  92.   hit_chk_x(2)=0  :hit_chk_y(2)=0
  93.   hit_chk_x(3)=0  :hit_chk_y(3)=0
  94.   hit_chk_x(4)=0  :hit_chk_y(4)=0
  95.   hit_chk_x(5)=0  :hit_chk_y(5)=0
  96.   hit_chk_x(6)=0  :hit_chk_y(6)=0
  97.   hit_chk_x(7)=0  :hit_chk_y(7)=0
  98.   hit_chk_x(8)=0  :hit_chk_y(8)=0
  99.   hit_chk_x(255)=0:hit_chk_y(255)=0
  100. /*----------------[ テキ ]------------------
  101. tk_move()
  102. /*----------------[ テキハッセイ ]------------------
  103. if (r255 and 63)=0 then tk_set(4,(r255+16)shl 8,0, 0,0 ,0,0)
  104. if r1023=0 then tk_set(5,&h8000,0, 0,0 ,0,0)
  105. /*----------------[ ジキ ]-----------------
  106. jk_move(stick(1))
  107. jd_move(strig(1))
  108. /*----------------[ ハヘン ]-----------------
  109. ha_move()
  110. /*================[ ハンヨウ カウンター ]========================
  111. r1   =r1   +1 and 1
  112. r7   =r7   +1 and 7
  113. r255 =r255 +1 and 255
  114. r1023=r1023+1 and 1023
  115. /*------------------------------------------------------
  116. palet(1,0)        /* ショリソクドメーター OFF
  117. endwhile
  118. end
  119. /*
  120. /*
  121. /*
  122. /*
  123. /*######################################################
  124. /*
  125. /* 自機移動
  126. /*
  127. /* jk_move(スティックナンバー)
  128. /*======================================================
  129. func jk_move(s)
  130. int  a,hit_dat,or_dat
  131. char n,ii
  132. /*......................................................
  133.   a = j_vx(s)
  134.   jx=jx+a
  135.   jy=jy+j_vy(s)
  136. /*
  137.   if jx<&H1000  then jx=&H1000
  138.   if jx>&H10000 then jx=&H10000
  139.   if jy<&H1000  then jy=&H1000
  140.   if jy>&H10000 then jy=&H10000
  141. /*-----[ ジキ カタムキショリ ]-----------------------------------
  142.   if a>0 then { jk=jk+1 } else { jk=jk-1 }
  143.   if a=0 then { if jk>0 then { jk=jk-1 }else{ jk=jk+1 } }
  144.   n=1
  145.   if jk<-4 then n=0:jk=-4
  146.   if jk> 4 then n=2:jk= 4
  147.   sp_set(0,jx shr 8,jy shr 8,&H905+n,3)
  148. /*-----[ ジキ ー テキ カンノ カソウvramシキ アタリハンテイ ]----------------
  149.   hit_dat = hit_chk_x(jx shr 13)
  150.   if hit_dat<>0 then {
  151.    hit_dat = hit_dat and hit_chk_y(jy shr 13)
  152.    if hit_dat<>0 then {
  153.   /*
  154.     or_dat=1
  155.     for ii=0 to tk_max
  156.       if (hit_dat and or_dat)<>0 then {
  157.         if abs(jy-tk_y(ii))<&hA00 then { 
  158.          if abs(jx-tk_x(ii))<&hA00 then { 
  159.            if (tk_attrib(ii)and 1)<>0 then {    /* ジキニ ハンテイノ アルキャラカ?チェック
  160.              tk_hit(ii,65535)
  161.            }
  162.          }
  163.         }
  164.       }
  165.     or_dat=or_dat shl 1
  166.     next
  167.    }
  168.   }
  169. /*--------------------------
  170. endfunc
  171. /*
  172. /*
  173. /*######################################################
  174. /*
  175. /* 自機弾処理
  176. /*
  177. /* jd_move(トリガナンバー)
  178. /*======================================================
  179. func jd_move(s)
  180. char i,j,ii,jj,no,ang
  181.  int x,y,or_dat
  182.  int hit_dat
  183. /*......................................................
  184. /*-----------[ ジキダンハッシャ チェック & ハッシャ ]-----------------
  185.   if (old_strig and 1)=0 and (s and 1)=1 then {
  186.     if jd_pointer>jd_way then {
  187.       for i=0 to jd_way
  188.         jd_pointer=jd_pointer-1
  189.         no=jd_stock(jd_pointer)
  190.         jd_x(no) =jx          :jd_y(no) =jy
  191.         jd_vx(no)=jd_vx_dat(i):jd_vy(no)=jd_vy_dat(i)
  192.       next
  193.     }
  194.   }
  195.   old_strig = s
  196. /*------------[ ジキダンイドウ & アタリハンテイ ]-----------------
  197.   jd_pointer=0
  198. /*
  199.   for i=0 to jd_max
  200.     y=jd_y(i)
  201.     if y>=0 then {
  202.       x = jd_x(i)+ jd_vx(i) :jd_x(i)=x
  203.       y = y      + jd_vy(i) :jd_y(i)=y
  204.       if x<0 or x>&h11000 then {
  205.         jd_y(i)=-1
  206.         sp_set(4+i,0,0)
  207.         jd_stock(jd_pointer)=i
  208.         jd_pointer=jd_pointer+1
  209.       } else {
  210.         /*------[ カソウvramシキ アタリハンテイ ]------
  211.         hit_dat = hit_chk_x(x shr 13)
  212.         if hit_dat<>0 then {
  213.          hit_dat = hit_dat and hit_chk_y(y shr 13)
  214.          if hit_dat<>0 then {
  215.         /*
  216.           or_dat=1
  217.           for ii=0 to tk_max
  218.             if (hit_dat and or_dat)<>0 then {
  219.               if abs(y-tk_y(ii))<&h1000 then { 
  220.                 if abs(x-tk_x(ii))<&h1000 then { 
  221.                   if (tk_attrib(ii)and 2)<>0 then {    /* ショットニハンテイノ アルキャラカ?チェック
  222.                     tk_hit(ii,1)
  223.                     jd_y(i)=-1:sp_set(i+4,0,0)
  224.                   }
  225.                 }
  226.               }
  227.             }
  228.           or_dat=or_dat shl 1
  229.           next
  230.          }
  231.         }
  232.         /*---------------------------------
  233.         sp_set(i+4,x shr 8,y shr 8,&h13f,3)
  234.       }
  235.     } else {
  236.       sp_set(4+i,0,0)
  237.       jd_stock(jd_pointer)=i
  238.       jd_pointer=jd_pointer+1
  239.     }
  240.   next
  241. /*------------------------------------------------------
  242. endfunc
  243. /*
  244. /*
  245. /*######################################################
  246. /*
  247. /* 破片処理
  248. /*
  249. /* ha_move()
  250. /*======================================================
  251. func ha_move()
  252. char i,for_start,for_end,s
  253.  int a
  254.  int x,y
  255. /*......................................................
  256. if r1=0 then ha_pointer=0
  257. /*
  258. for_start = r1 shl 5
  259. for_end = for_start+31
  260. s=64
  261. /*
  262. for i=for_start to for_end
  263.   switch ha_s(i)
  264.     case 0
  265.       ha_stock(ha_pointer)=i
  266.       ha_pointer=ha_pointer+1
  267.       break
  268.     case 1    /*----------------[ バクハツ ]
  269.       a = ha_timer(i)-12-(i and 7):ha_timer(i)=a
  270.       if a<0 then {
  271.         ha_s(i)=0
  272.         sp_set(s,0,0)
  273.       } else {
  274.         x = ha_x(i)+ha_vx(i):ha_x(i)=x
  275.         y = ha_y(i)+ha_vy(i):ha_y(i)=y
  276.         sp_set(s,x shr 8,y shr 8,&h148+(a shr 5),3)
  277.         if ((i+r7)and 7)<2 then {
  278.           ha_vx(i)=ha_vx(i)/4
  279.           ha_vy(i)=ha_vy(i)/4
  280.         }
  281.       }
  282.       break
  283.     case 2    /*----------------[ ハヘン ]  
  284.       a = ha_timer(i)-10-(i and 15):ha_timer(i)=a
  285.       if a<0 then {
  286.         ha_s(i)=0
  287.         sp_set(s,0,0)
  288.       } else {
  289.         x = ha_x(i)+ha_vx(i):ha_x(i)=x
  290.         y = ha_y(i)+ha_vy(i):ha_y(i)=y
  291.         sp_set(s,(x shr 8)and 1023,(y shr 8)and 1023,&h140+((a shr 5) and 3)+(i and 4),3)
  292.       }
  293.       break
  294.     case 3    /*----------------[ ケムリ ]  
  295.       a = ha_timer(i)-32:ha_timer(i)=a
  296.       if a<0 then {
  297.         ha_s(i)=0
  298.         sp_set(s,0,0)
  299.       } else {
  300.         x = ha_x(i)+ha_vx(i):ha_x(i)=x
  301.         y = ha_y(i)+ha_vy(i):ha_y(i)=y
  302.         sp_set(s,(x shr 8)and 1023,(y shr 8)and 1023,&h223-(a shr 6),3)
  303.       }
  304.       break
  305.   endswitch
  306. s=s+1:next
  307. endfunc
  308. /*
  309. /*
  310. /*######################################################
  311. /*
  312. /* 破片発生
  313. /*
  314. /* ha_set(種類no,x,y,xベクトル,yベクトル)
  315. /*======================================================
  316. func ha_set(s,x,y,vx,vy)
  317. char no
  318. /*......................................................
  319. if ha_pointer>0 and s<>0 then {
  320.   ha_pointer=ha_pointer-1
  321.   no=ha_stock(ha_pointer)
  322.   ha_x(no) =x :ha_y(no) =y
  323.   ha_vx(no)=vx:ha_vy(no)=vy
  324.   ha_s(no)=s
  325.   ha_timer(no)=255
  326. }
  327. endfunc
  328. /*
  329. /*
  330. /*######################################################
  331. /*
  332. /* 敵処理
  333. /*
  334. /* tk_move()
  335. /*======================================================
  336. func tk_move()
  337. char i
  338. char x_adr,y_adr    /* アタリハンテイヨウ カソウvramジョウノアドレス
  339. int  or_dat=1        /* カソウvramノ ドノビットヲ タテルカ
  340. int  ts,tx,ty,a,b
  341. char attrib,ang,angle1,angle2
  342. /*......................................................
  343. tk_pointer=0
  344. /*
  345. for i=0 to tk_max
  346.   tx = tk_x(i)
  347.   ty = tk_y(i)
  348.   ts=tk_s(i)
  349.   switch ts
  350.     case 0
  351.       attrib = 0
  352.       tk_stock(tk_pointer)=i
  353.       tk_pointer=tk_pointer+1
  354.       break
  355.     /*
  356.     case 1    /*----------------[ バクハツ ]
  357.       attrib = 0
  358.       a = tk_timer(i)-16:tk_timer(i) = a
  359.       if a<0 then {
  360.         tk_s(i)=0:sp_set(96+i,0,0)
  361.       } else {
  362.         sp_set(i+96,tx shr 8,ty shr 8,&h148+(a shr 5),3)
  363.       }
  364.       break
  365.     /*
  366.     case 2    /*----------------[ テキダン ]
  367.       attrib = &b101
  368.       tx =tx + tk_vx(i)
  369.       ty =ty + tk_vy(i)
  370.       a = tk_timer(i)+1 and 15:tk_timer(i) = a
  371.       sp_set(i+96,tx shr 8,ty shr 8,&hC18+(a shr 1),3)
  372.       break
  373.     /*
  374.     case 3    /*----------------[ ホーミングミサイル ]
  375.       attrib = &b111
  376.       angle1 = tk_ang(i)
  377.       angle2 = angle(jx-tx,jy-ty) and 252
  378.       if ((angle2-angle1) and 252)<>0 then {
  379.         if (angle2-angle1 and 128)=0 then {
  380.           angle1 = angle1+4 and 255
  381.         } else { 
  382.           angle1 = angle1-4 and 255
  383.         }
  384.       }
  385.       tk_ang(i) = angle1
  386.     /*
  387.       tx =tx +cir_8x(angle1)
  388.       ty =ty +cir_8y(angle1)
  389.       sp_set(i+96,tx shr 8,ty shr 8,&h130 or hd16(angle1),3)
  390.       if (r255+i and 1)=0 then ha_set(3,tx,ty,-cir_8x(angle1),-cir_8y(angle1))
  391.       break
  392.     /*
  393.     case 4    /*----------------[ ザコ1 ]
  394.       attrib = &b111
  395.       ty = ty+&h300
  396.       sp_set(i+96,tx shr 8,ty shr 8,&h128+(i+r7 and 7),3)
  397.       if (r255+i and 31)=0 then {
  398.         ang = angle(jx-tx,jy-ty)
  399.         tk_set(3,tx,ty, 0,0, ang           ,0)
  400.         tk_set(3,tx,ty, 0,0, ang+64 and 255,0)
  401.         tk_set(3,tx,ty, 0,0, ang-64 and 255,0)
  402.         tk_set(2,tx,ty, cir_4x(ang),cir_4y(ang), ang,0)
  403.       }
  404.       break
  405.     case 5    /*----------------[ ボス? ]
  406.       attrib = &b111
  407.       if ty<&h6000 then ty=ty+&h100
  408.       sp_set(i+96,tx shr 8,ty shr 8,&h8928,3)
  409.       if (r255 and &h49)=0 then {
  410.         ang = angle(jx-tx,jy-ty)
  411.         tk_set(2,tx,ty, cir_8x(ang),cir_8y(ang), ang,0)
  412.       }
  413.       if (r255 and &h43)=&h40 then {
  414.         ang = r255 and 63
  415.         tk_set(2,tx,ty, cir_8x( 128 + ang ),cir_8y( 128 + ang ), 128+ang ,0)
  416.         tk_set(2,tx,ty, cir_8x( 128 - ang ),cir_8y( 128 - ang ), 128-ang ,0)
  417.       }
  418.       break
  419.     case 6    /*----------------[ ボス ゴエイザコ ]
  420.       attrib = &b011
  421.       ang = tk_ang(i)+5 and 255:tk_ang(i)=ang
  422.       a = tk_com(i)
  423.       tx = tk_x(a) + cir_64x(ang)
  424.       ty = tk_y(a) + cir_64y(ang)
  425.       sp_set(i+96,(tx shr 8) and 1023,(ty shr 8)and 1023,&h128+(i+r7 and 7),3)
  426.     /*
  427.       if tk_s(a)=0 then tk_hit(i,65535)
  428.       break
  429.   /*...................................................
  430.   endswitch
  431.   tk_attrib(i)=attrib
  432.   tk_x(i) = tx
  433.   tk_y(i) = ty
  434. /*-----------------------------------------------------
  435. /*......[ カソウvram カキコミ ]...............................
  436.   if (attrib and 3)<>0 then {
  437.       x_adr=((tx-&h1000)shr 13)
  438.       hit_chk_x( x_adr   ) = hit_chk_x( x_adr   )or or_dat
  439.       hit_chk_x( x_adr+1 ) = hit_chk_x( x_adr+1 )or or_dat
  440.       y_adr=((ty-&h1000)shr 13)
  441.       hit_chk_y( y_adr   ) = hit_chk_y( y_adr   )or or_dat
  442.       hit_chk_y( y_adr+1 ) = hit_chk_y( y_adr+1 )or or_dat
  443.   }
  444. /*......[ ガメンガイニデタカ?チェック ]..........................
  445.   if (attrib and 4)<>0 then {
  446.     if (ty and &h7FFFFFFF)>&h11000 or (tx and &h7FFFFFFF)>&h11000 then tk_s(i)=0:sp_set(96+i,0,0)
  447.   }
  448. /*------------------------------------------------------
  449.   or_dat=or_dat shl 1
  450. next
  451. endfunc
  452. /*
  453. /*
  454. /*######################################################
  455. /*
  456. /* 敵発生
  457. /*
  458. /* tk_set(種類no,x,y, xベクトル,yベクトル,方向No,集合先)
  459. /*======================================================
  460. func tk_set(s,x,y,vx,vy,ang,com)
  461. char no,i
  462. /*......................................................
  463. if tk_pointer>0 and s<>0 then {
  464.   tk_pointer=tk_pointer-1
  465.   no=tk_stock(tk_pointer)
  466. /*.......................................
  467.   tk_s(no)=s
  468.   tk_x(no) =x :tk_y(no) =y
  469.   tk_vx(no)=vx:tk_vy(no)=vy
  470.   tk_ang(no)=ang
  471.   tk_com(no)=com
  472. /*
  473.   tk_timer(no)=255
  474.   tk_life(no) =tk_life_dat(s)
  475. /*........................................
  476.   if s=5 then {
  477.     for i=0 to 7
  478.       tk_set(6,x,y, 0,0, (i shl 5),no)
  479.     next
  480.   }
  481. /*........................................
  482. }
  483. endfunc
  484. /*
  485. /*
  486. /*######################################################
  487. /*
  488. /* 敵に HIT
  489. /*
  490. /* tk_hit(no,ダメージ数)
  491. /*======================================================
  492. func tk_hit(no;char,damege)
  493.  int tx,ty
  494. char ang
  495. /*......................................................
  496. tk_life(no) = tk_life(no)-damege
  497. if tk_life(no)<=0 then {
  498.   tx=tk_x(no):ty=tk_y(no)
  499.   if tk_s(no)>=4 then bom(5,tx,ty)
  500.   tk_s(no)=1:tk_timer(no)=255
  501.   tk_attrib(no)=0
  502. }
  503. /*------------------------------------------------------
  504. endfunc
  505. /*
  506. /*
  507. /*######################################################
  508. /*
  509. /* 破片炸裂
  510. /*
  511. /* bom(破片数,x,y)
  512. /*======================================================
  513. func bom(s,x,y)
  514. int i
  515. /*......................................................
  516. for i=0 to s
  517.   ha_set(2,x,y,cir_4x(bom_ang1),cir_4y(bom_ang2))
  518.   bom_ang1 = bom_ang1+77 and 255
  519.   bom_ang2 = bom_ang2+53 and 255
  520. next
  521. endfunc
  522. /*
  523. /*
  524. /*#######################################################
  525. /*
  526. /* 角度計算(高速 & 誤差軽減)
  527. /*
  528. /* angle(ex-sx,ey-sy)で(sx,sy)から見た(ex,ey)の角度算出。
  529. /* テーブルとして qtoc(255) を使用。忘れずLOADせよ。
  530. /* 戻り値 = 角度ナンバー(0ー255)
  531. /*-------------------------------------------------------
  532. func angle(x,y)
  533. int a,abs_x,abs_y
  534. /*
  535. if x=0 then x=1
  536. if y=0 then y=1
  537. if x>0 then abs_x=x else abs_x=-x
  538. if y>0 then abs_y=y else abs_y=-y
  539. if abs_x>abs_y then {
  540.   if x>0 then {
  541.     if y>0 then {
  542.       a=&h40 + ((y shl 5)+(abs_x shr 1))/abs_x
  543.     } else {
  544.       a=&h40 + ((y shl 5)-(abs_x shr 1))/abs_x
  545.     }
  546.   } else {
  547.     if y>0 then {
  548.       a=&hC0 - ((y shl 5)+(abs_x shr 1))/abs_x
  549.     } else {
  550.       a=&hC0 - ((y shl 5)-(abs_x shr 1))/abs_x
  551.     }
  552.   }
  553. } else {
  554.   if y>0 then {
  555.     if x>0 then {
  556.       a=&h80 - ((x shl 5)+(abs_y shr 1))/abs_y
  557.     } else {
  558.       a=&h80 - ((x shl 5)-(abs_y shr 1))/abs_y
  559.     }
  560.   } else {
  561.     if x>0 then {
  562.       a=       ((x shl 5)+(abs_y shr 1))/abs_y
  563.     } else {
  564.       a=       ((x shl 5)-(abs_y shr 1))/abs_y
  565.     }
  566.   }
  567. }
  568. /*ーーーーーーーーーーーーーーーーー
  569. return(qtoc(a and 255))
  570. endfunc
  571. /*
  572. /*
  573. /*######################################################
  574. /*   GAME_INIT()
  575. /* 
  576. /* game_init()
  577. /* GAMEの初期化
  578. /*======================================================
  579. func game_init()
  580. int   i,j,fn
  581. float f,fx,fy,angle,pi_dat
  582. /*......................................................
  583.   scr_init()
  584. /*--------------[ カクシュデータ LOAD ]-----------------------
  585. fn = chk_open("CIR\QtoC","r")
  586. fread(qtoc,256,fn):fclose(fn)
  587. /*
  588. fn = chk_open("CIR\HD16","r")
  589. fread(hd16,256,fn):fclose(fn)
  590. /*
  591. /*--------------[ sin/cos ベクトル データ ]------------------
  592.   pi_dat=pi()
  593.   for i=0 to 255
  594.     f=i
  595.     angle = -pi_dat*(0.5#-2*f/256)
  596.     fx = cos(angle)
  597.     fy = sin(angle)
  598.     cir_x(i) = fx
  599.     cir_y(i) = fy
  600. /*..............[ データ カクチョウ ]................
  601.     cir_2x(i) = fx*&h200
  602.     cir_2y(i) = fy*&h200
  603.     cir_4x(i) = fx*&h400
  604.     cir_4y(i) = fy*&h400
  605.     cir_8x(i) = fx*&h800
  606.     cir_8y(i) = fy*&h800
  607.     cir_16x(i)= fx*&h1000
  608.     cir_16y(i)= fy*&h1000
  609.     cir_64x(i)= fx*&h4000
  610.     cir_64y(i)= fy*&h4000
  611.   next
  612. /*--------------[ ジキイドウベクトル データ ]-------------------
  613.   j=1
  614.   for i=0 to 255
  615.     j_vx(tenkey(j))=cir_x(i)*j_sp*&H100
  616.     j_vy(tenkey(j))=cir_y(i)*j_sp*&H100
  617.     j=j+1:i=i+31
  618.   next
  619. /*--------------[ ジキダンベクトル データ ]--------------------
  620.   for i=0 to 14
  621.     j=(i-7)*4 and 255
  622.     fx=cir_x(j)*&hC00:jd_vx_dat(i)=fx
  623.     fy=cir_y(j)*&hC00:jd_vy_dat(i)=fy
  624.   next
  625. /*------------------------------------------------------
  626.   for i=0 to 127
  627.     sp_set(i,0,0)        /* ゼンスプライトノショウキョ
  628.   next
  629. /*------------------------------------------------------
  630.   for i=0 to 63
  631.     jd_y(i)=-1            /* ゼンジキダンヲ ガメンガイヘ
  632.     ha_s(i)=0            /* ゼンハヘンノシュルイナンバーヲ 0ニ
  633.     tk_s(i)=0            /* ゼンテキノシュルイナンバーヲ 0ニ
  634.   next
  635. /*------------------------------------------------------
  636.   jd_pointer=0
  637.   ha_pointer=0
  638.   tk_pointer=0
  639.   jx=&h8000:jy=&hC000
  640. /*------------------------------------------------------
  641. endfunc
  642. /*
  643. /*
  644. /*######################################################
  645. /*   SCR_INIT()
  646. /* 
  647. /* scr_init()
  648. /* 画面を GAME専用に設定する。
  649. /*======================================================
  650. func scr_init()
  651. int i
  652. /*-------------------------
  653. screen 0,2,1,1
  654. sp_on(0,127)
  655. for i=0 to 127:sp_set(i,0,0,0,3):next
  656. sp_disp(1)
  657. bg_set(0,0,1):bg_scroll(0,0,0)
  658. bg_set(1,1,1):bg_scroll(1,0,0)
  659. bg_fill(0,0):bg_fill(1,0)
  660. mouse(4):mouse(2)
  661. endfunc
  662. /*
  663. /*
  664. /*##########################################################/*
  665. /* CHK_OPEN                                         /*
  666. /* chk_open( "filename","モード" )                            /*
  667. /* モードは、fopen と同じ。
  668. /*----------------------------------------------------------/*
  669. func chk_open(fname;str,mode;str)
  670. int fn
  671. /*::::::::::::::::
  672. error off
  673. fn=fopen(fname,mode)
  674. error on
  675. if fn<0 then {
  676.   width 96
  677.   color 7:beep
  678.   print fname;" が、OPENできません。"
  679.   print
  680.   print "強制終了します。( HIT ANY KEY )"
  681.   while strig(1)<>0 or strig(2)<>0 or inkey$(0)<>"":endwhile
  682.   while strig(1)=0 and strig(2)=0 and inkey$(0)="" :endwhile
  683.   end
  684. }
  685. return(fn)
  686. endfunc
  687.